package com.hm.hall.commons.dao;

import com.hm.hall.commons.domain.BattleRoomUser;
import com.hm.hall.commons.domain.BattleRoomUserExample;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public interface BattleRoomUserMapper {
    int countByExample(BattleRoomUserExample example);

    int deleteByExample(BattleRoomUserExample example);

    int deleteByPrimaryKey(Long recordId);

    int insert(BattleRoomUser record);

    int insertSelective(BattleRoomUser record);

    int insertSelectiveGetKey(BattleRoomUser record);

    List<BattleRoomUser> selectByExample(BattleRoomUserExample example);

    BattleRoomUser selectByPrimaryKey(Long recordId);

    int updateByExampleSelective(@Param("record") BattleRoomUser record, @Param("example") BattleRoomUserExample example);

    int updateByExample(@Param("record") BattleRoomUser record, @Param("example") BattleRoomUserExample example);

    int updateByPrimaryKeySelective(BattleRoomUser record);

    int updateByPrimaryKey(BattleRoomUser record);


    @Update("UPDATE t_battle_room  br RIGHT JOIN t_battle_room_user ru ON br.room_id = ru.room_id   SET ru.in_room_status =-1  WHERE br.room_status IN (1,4) AND ru.in_room_status=1 AND ru.user_id=#{userId}")
    int updateRoomUserStatus(@Param("userId") long userId);
}